home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / Mac Satellite.sit / Mac Satellite / Season9 Info / details.txt < prev    next >
Text File  |  1995-08-28  |  29KB  |  557 lines

  1.  
  2. Some technical details about Videocrypt
  3. ---------------------------------------
  4.  
  5. Markus Kuhn -- 1994-08-02
  6.  
  7.  
  8. In this file, I'll collect some of the details known or assumed about
  9. the Videocrypt pay-TV access control system. Consider it as some kind
  10. of frequently asked questions list with answers about the system.
  11.  
  12.  
  13. 1  Basic principle
  14.  
  15. Videocrypt encodes the TV image by cutting each line of the image in
  16. two pieces at some cut point and then exchanges these two line
  17. fragments in the broadcasted pictures. E.g. if a line like
  18.  
  19.    0123456789
  20.  
  21. passes the encoder, the output might look like
  22.  
  23.    4567890123
  24.  
  25. where the digits represent the pixels of the image. There are 256
  26. possible cut points and there are no cut points directly near the image
  27. border (the miniumum distance from the margin is about 12-15% of the
  28. image width) which is the reason why you sometimes still can see
  29. vertical patterns even on an encrypted image. The sound is currently
  30. not encrypted.
  31.  
  32. Several times per second, a computer at the broadcasting station
  33. generates a 32 byte long message which is broadcasted encoded together
  34. with forward error correction information in the first invisible lines
  35. of the TV signal similar to teletext. About every 2.5 seconds, one of
  36. these 32-byte messages is processed in the encoder by a secret hash
  37. algorithm which transforms the 32-byte message into a 60-bit value.
  38. These 60 bits are then used by a second algorithm in order to determine
  39. the 8-bit cut point coordinates for each line for the next 2.5 seconds.
  40. No details about this second algorithm are known, but think of it just
  41. as some kind of 60-bit pseudo random number generator (PRNG) were the
  42. 60-bit output from the secret hash function is used as a start value
  43. (seed).
  44.  
  45. The decoder receives the 32-byte messages and other data together with
  46. the TV signal, applies some error correction algorithms and passes all
  47. 32-byte packets to the smart card in the decoder's card slot. The smart
  48. card implements the same secret hash function and answers with the same
  49. 60-bit value as the one which is used in the encoder. By using this
  50. 60-bit answer from the card, the decoder hardware can generate with the
  51. same PRNG the same cut point sequence as the encoder and can so
  52. reconstruct the original image by again exchanging the two line
  53. fragments. The secret hash function is a cryptographically strong
  54. system which is designed so that it is extremely difficult to guess the
  55. algorithm of this function by looking at many pairs of 32-byte/60-bit
  56. values.
  57.  
  58. Apart from being the source for the generation of the 60-bit PRNG seed,
  59. the 32-byte messages from the broadcasting station contain card numbers
  60. so that individual cards can be addressed and they contain commands
  61. like activation, deactivation and pay-per-view account modification. In
  62. addition, the 32-byte packets contain a digital signature (currently 4
  63. bytes) that allows the card to test whether the 32-byte messages really
  64. originate from the encoder and have not been generated by someone
  65. analysing the card. Again, this digital signature like the hash
  66. function has been designed so that it is difficult to find out how to
  67. generate a correct signature by looking at enough examples. This
  68. prevents choosen-text attacks, where someone tries to probe the secret
  69. hash function with very carefully selected 32-byte messages and this
  70. prevents hackers to generate new activation commands for the card.
  71.  
  72. In early 1993, someone managed to get access to the secret hash
  73. functions of several stations which use Videocrypt (e.g., British Sky
  74. Broadcasting, Adult Channel, JSTV, BOB, Red Hot TV). Most of these
  75. systems used the same hash and signature algorithm and the only
  76. difference between the stations was a 32-byte secret key table. It is
  77. not known, how it was possible to get this information. Either someone
  78. from the company who manufactured the cards (News Datacom Ltd.)
  79. released this information or it was possible for someone to read out
  80. the EEPROM contents of the card processor (very difficult, but
  81. theoretically possible). With this knowledge it was then quite easily
  82. possible for the original hackers to produce 'clone cards'. These are
  83. simple PCBs with a cheap microcontroller (e.g. one of Microchip's PIC
  84. family), which implements only the secret hash function and serial I/O
  85. procedures in its EPROM and answers with the correct 60-bit values to
  86. 32-byte messages just as the real cards do. For several channels, clone
  87. cards are still available, but BSkyB distributed new 09 series cards in
  88. spring 1994 and switched on 1994-05-18 to a new secret hash ans
  89. signature function. Consequently, all clone cards stopped to work.
  90.  
  91. The clone cards didn't implement any interpretation procedures for card
  92. activation, deactivation and pay-per-view functions, so their software
  93. is considerably simpler than the one in the real cards. This resulted
  94. in some tiny differences between the reaction of the clone card
  95. software and the reaction of the original card software on pathological
  96. 32-byte messages. These differences were used in counter measures
  97. (commonly referred to as ECMs) against clone cards several times in
  98. 1993 and 1994 by BSkyS and News Datacom in order to deactivate clone
  99. cards, but it was quite easy each time to find out these tiny bugs in
  100. the clone card software and correct it.
  101.  
  102. There are two microprocessors in a typical Videocrypt decoder. An Intel
  103. 8052 microcontroler manages the communication between the smart card
  104. and the rest of the system. As the software of this processor is not
  105. read protected, it was also possible to reprogram this chip (by using
  106. the EPROM version 8752BH) so that the hash algorithm is performed
  107. inside the decoder. Then no external card is needed at all for the
  108. channels for which the hash algorithm was implemented in the 8752. The
  109. second processor is a Motorola 6805 variant and its internal ROM
  110. contents can't be read out easily. The Motorola decodes the data that
  111. comes with the TV signal, applies error correction algorithms to this
  112. data, exchanges the 32-byte messages and 8-byte answers with the Intel
  113. processor and controls the PRNG and the on-screen display hardware.
  114.  
  115. There are also Videocrypt II decoders available. These work almost like
  116. the Videocrypt decoders and the only important difference is a new
  117. software in the Intel and Motorola processor. Videocrypt II decoders
  118. get their data from other invisible TV lines than Videocrypt, and it is
  119. possible to broadcast a signal encrypted in a way that allows both
  120. Videocrypt and Videocrypt II to decode it with different smart cards.
  121.  
  122. More detailed basic information about Videocrypt has been published in
  123. the European patent EP 0 428 252 A2 ("A system for controlling access
  124. to broadcast transmissions"). You can order a copy for little money
  125. (about 10 DM) from the European Patent Office (Schottenweldgasse 29,
  126. A-1072 Wien, Austria) if you are interested.
  127.  
  128.  
  129. 2  Security of the Videocrypt system
  130.  
  131. The system is very secure, because all secret parts that are essential
  132. to a successful decryption are located in the smart card and if the
  133. card's secret hash algorithm/key becomes known, it can easily be
  134. replaced by just sending new cards to the subscribers. This card
  135. exchange can also be used if details about the format of the commands
  136. hidden in the 32-byte sequences sent to the card become known which
  137. allows together with the knowledge of the signature algorithm to
  138. generate new activation messages and to filter out deactivation
  139. messages.
  140.  
  141. There are however at least two obvious security flaws of the system
  142. which can't be removed by new smart card generations:
  143.  
  144.   - The dialog between the card and the decoder is the same synchronously
  145.     for all Videocrypt decoders switched to this channel. I.e., the decoder
  146.     doesn't add any card specific or decoder specific information to the
  147.     traffic. This makes it possible to use one card for several decoders.
  148.     E.g. it is possible to record the 32-byte messages broadcasted by
  149.     the station during an evening with a PC, then send these messages to
  150.     someone else with an original card who asks his card for the 60-bit
  151.     answers to all the recorded messages. If this person then sends
  152.     these 60-bit answers back, then you can use this data in order
  153.     to descramble the VCR recorded program of this evening (delayed data
  154.     transfer). However, decoding VHS recorded encrypted signals produces
  155.     minor color distortions and a few VCRs don't preserve the Videocrypt
  156.     data stream in the first invisible lines that accompanies the TV
  157.     signal. It is also possible to distribute the 60-bit answers from
  158.     one card in real-time with cables to many decoders in a house or
  159.     with radio signals to many decoders in a larger region.
  160.  
  161.   - The simple cut-and-exchange encryption method and the fact that two
  162.     consecutive lines in an image are almost always nearly identical
  163.     makes it possible to try all 256 possible cut points and to select
  164.     the one which causes both lines to fit together best. This method
  165.     has alreday been implemented on fast PC's with framegrabbers which
  166.     load the image into the memory and display it corrected on the computer
  167.     screen (many seconds per frame), on parallel supercomputers which
  168.     allow almost real-time decryption and with special hardware that
  169.     achieves real-time decryption. Howevery, with this decoding method,
  170.     there are severe image quality losses and many additional problems
  171.     which together with the high hardware costs required (much higher
  172.     than a regular subscription) don't make this approach very practical
  173.     for every day usage.
  174.  
  175. Both these security gaps in the videocrypt systems don't allow
  176. comfortable and easy high quality decryption like using a card, but the
  177. described methods have already been successfully used by a few
  178. technically skilled peoples for watching encrypted program.
  179.  
  180.  
  181. 3  ISO card protocol
  182.  
  183. The card and the protocol used to cummunicate with it conform exactly
  184. to the international standard ISO 7816. The options used from this
  185. standard are: T=0 asynchronous halfduplex character transmission
  186. protocol, active low reset and inverse convention. Only a few basic
  187. principles of the ISO protocol will be explained here. For much more
  188. detailed information, please read the ISO standard which you can order
  189. from your national standards body (e.g. DIN, ANSI, AFNOR, BSI, DS,
  190. etc.). There are three parts of the standard: ISO 7816-1 describes
  191. physical characteristics of the card and quality tests a card has to
  192. survive, ISO 7816-2 describes the location and meaning of the contacts
  193. and ISO 7816-3 (most important) describes the electrical
  194. characteristics, the answer-to-reset message and the protocol. 
  195.  
  196. The data format is an asynchronous 9600 bit/s serial format similar to
  197. that used on RS-232 lines with 8 data bits, 1 parity bit and two stop
  198. bits. The parity is even (but if inverse bit meaning convention is
  199. used, a RS-232 interface has to be programmed for odd parity in order
  200. to produce the correct bit). There is also an error detection and
  201. character repetition mechanism in the protocol which is not supported
  202. by RS-232 interfaces: If the receiving device (card or decoder) detects
  203. a parity error, it sends an impulse during the stop bit time. This will
  204. tell the sender to retransmit one byte.
  205.  
  206. After a reset impulse to the card, the card answers with an
  207. answer-to-reset message with some information about the requirements of
  208. the card. If the first byte is 3fh, then this means that in order to
  209. read the bytes with a RS-232 interface, you'll have to invert and
  210. reverse all bits. A typical answer-to-reset looks e.g. like the
  211. following one:
  212.  
  213.      3f fa 11 25 05 00 01 b0 02 00 00 4d 59 00 81 80 
  214.          |  |  |  |  | | 'historic characters' with|
  215.          |  |  |  |  | | information about chip and|
  216.          |  |  |  |  | | software version, etc.    |
  217.          |  |  |  |  |
  218.          |  |  |  |  +- low nibble: protocol type T=0,
  219.          |  |  |  |     high nibble: end of ISO part
  220.          |  |  |  |
  221.          |  |  |  +- requests 5 additional stop bits  
  222.          |  |  |
  223.          |  |  +- encodes programming voltage and max. programming
  224.          |  |     current (here: 5V, 50mA)
  225.          |  |
  226.          |  +- clock freq.: 11h=3.5 MHz, 31h=7 MHz
  227.          |
  228.          +- the 0ah low nibble means: 10 'historic characters' which
  229.             are not defined in the ISO standard are appended to
  230.             the reset answer
  231.  
  232. The answer-to-reset message has a variable length format. Some bits
  233. specify whether certain bytes are present or not. If the lowest bit in
  234. the high nibble of the second byte is 1, then the above shown third
  235. byte is present and determines the relation between the bit rate and
  236. the clock frequency after the reset answer. E.g., 11h means that 372
  237. clock cycles are one bit duration (default), i.e. with a clock
  238. frequency of 3.5712 Mhz, the bit frequency is 9600 Hz. In the
  239. Videocrypt system, the bit rate is always 9600 bits/s, but a value of
  240. 31h (= factor 744) in the third byte requests a doubled clock frequency
  241. (~7MHz) from the decoder. Other values are not supported by the
  242. Videocrypt decoder. 
  243.  
  244. The Videocrypt decoder supports several programming voltages (5 V, 12.5
  245. V, 15 V and 21 V, max. 50 mA current) and different numbers of stop
  246. bits (>= 5) sent to the card. All these parameters can be selected in
  247. the answer-to-reset. Of the 'historic characters' part, the decoder
  248. only verifies that it is at least 7 characters long and that the values
  249. 4dh und 59h are at the positions as in the example, otherwise the card
  250. is rejected. No more details about the information in the historic
  251. characters part of a Videocrypt card is currently known. For the
  252. detailed format of the answer-to-reset message, please consult ISO
  253. 7816-3.
  254.  
  255. The T=0 protocol is a half duplex master slave protocol. The decoder
  256. can send commands to the card followed by a data transmission either to
  257. or from the card. The card can do some limited flow control and can
  258. request or deactivate the programming voltage VPP selected in the
  259. answer-to-reset using "procedure bytes". If the decoder initiates a
  260. command, it sends five header bytes to the card, e.g.
  261.  
  262.      53 78 00 00 08
  263.  
  264. The first byte (CLA) is the command class code and is always 53h in the
  265. Videocrypt system. The second byte (INS) is the instruction code. Its
  266. lowest bit is always 0 and instruction codes have never a 6 or 9 high
  267. nibble (you'll see below, why). The following 2 bytes (P1 and P2) are a
  268. reference (e.g. an address) completing the instruction code and a
  269. Videocrypt decoder sets them always to 00 00. The final byte (P3) codes
  270. the number of data bytes which are to be transmitted during the
  271. command. P3=0 has a special meaning: In data transfers from the card,
  272. it indicates 256 data bytes, in data transfers from the decoder, it
  273. indicates 0 bytes. The direction of the data transfer is determined by
  274. CLA and INS and must be known in advance by both the card and the
  275. decoder.
  276.  
  277. After transmission of such a 5-byte header, the decoder waits for a
  278. 'procedure byte' from the card.
  279.  
  280. The following procedure bytes are possible:
  281.  
  282.   60h             Please wait, I'll send another procedure byte soon,
  283.                   don't timeout.
  284.  
  285.   INS             Now let's transfer all (remaining) data bytes, I don't
  286.                   need programming voltage.
  287.  
  288.   INS+1           Now let's transfer all (remaining) data bytes and please 
  289.                   activate VPP.
  290.  
  291.   INS xor ffh     Now let's transfer another single data byte,
  292.                   I don't need programming voltage.
  293.  
  294.   (INS+1) xor ffh Now let's transfer another single data byte, and please
  295.                   activate VPP.
  296.  
  297.   6Xh or 9Xh      This byte SW1 indicates an end of the data transfer
  298.                   and requests to deactivate VPP. A second status byte SW2
  299.                   follows from the card. SW1 SW2 = 90 00 indicates a
  300.                   normal termination, other values report e.g. an error.
  301.                   
  302. After each data transfer, the decoder waits for another procedure byte.
  303. E.g., a typical decoder<->card dialog looks like this (command 78h
  304. requests the 60-bit answer as 8 bytes from the card):
  305.  
  306.      decoder sends header
  307.        53 78 00 00 08
  308.      card sends procedure byte (all at once, no VPP)
  309.        78
  310.      card sends P3 data bytes
  311.        80 52 02 79 f5 39 7c 0e
  312.      card closes with SW1 and SW2
  313.        90 00
  314.  
  315.  
  316. 4  Videocrypt protocol
  317.  
  318. The newer Videocrypt smart cards don't require any programming voltage
  319. (the VPP pin isn't even connected). Although, the ISO standard requires
  320. only 2 stop bits after each transfered byte, Videocrypt decoders seem
  321. to require more than 5 stop bits. As PC serial ports don't support more
  322. than 2 stop bits directly, a card emulator software has to wait for
  323. about 0.5-1.5 ms after each byte. Cards can announce in the
  324. answer-to-reset message, how many stop bits they require and Videocrypt
  325. cards also do require more than 2 stop bits.
  326.  
  327. A videocrypt decoder knows the following 10 commands (all with CLA=53h
  328. and P1=P2=00h):
  329.  
  330.      INS     length (P3)      direction        purpose
  331.     ---------------------------------------------------------------------
  332.      70h         6            from card        serial number, etc.
  333.      72h        16            to card          message from previous card
  334.      74h        32            to card          message from station
  335.      76h         1            to card          authorize button pressed
  336.      78h         8            from card        60-bit answer
  337.      7ah        25            from card        onscreen message
  338.      7ch        16            from card        message to next card
  339.      7eh        64            from card        ??? \
  340.      80h         1            to card          ???  > perhaps Fiat-Shamir 
  341.      82h        64            from card        ??? /  authentication?
  342.  
  343. The following things are known about the data bytes of these commands:
  344.  
  345. 70h:
  346.  
  347. In BSkyB cards, the 70h data contains the card issue number (e.g. 07 or
  348. 09) in the low nibble of the first byte. The high nibble of the first
  349. byte seems to be always 2. The next 4 bytes form an 32-bit bigendian
  350. integer value which corresponds to the decimal card number without the
  351. final digit of the card number (which is perhaps a check digit,
  352. algorithm unknown). The meaning of the final byte is unknown.
  353.  
  354. 72h and 7ch:
  355.  
  356. Several times per second, the decoder requests with 7ch 16 bytes from
  357. the card. If a card is removed and a new card is inserted in the
  358. decoder without switching off the power of the decoder, then shortly
  359. after the card reset, the decoder sends the latest 7ch data bytes from
  360. the previous card in a 72h message to the new card. In this way, 16
  361. bytes information (e.g. the status of a pay-per-view account or a list
  362. of activated channels?) can be transfered from one card to the next.
  363.  
  364. 74h and 78h:
  365.  
  366. The 74h command transfers the 32-byte messages from the broadcasting
  367. station to the card. If the third bit (value 8) in the first byte is
  368. set, then the decoder will ask with a 78h command for the 60-bit
  369. answer. This happens about every 5th 74h packet every 2.5 seconds. The
  370. high nibble of the final byte in the 78h data is ignored by the decoder
  371. (only 60 bits are needed). The high nibble of the first 74h byte seems
  372. to have the value eh or fh in normal encrypted operation and ch or dh
  373. in the 'soft scrambled' mode where the decoder can descramble the image
  374. even without any card. 
  375.  
  376. The following information is valid for the 07 and 09 BSkyB card and need not
  377. necessarily be true for future smart cards, because these data bytes
  378. don't seem to be interpreted in the decoder and so their meaning can be
  379. exchanged. A typical BSkyB 74h packet for the 09 series card looks like
  380. this:
  381.  
  382.   e843 0a888261 0c 29e403f6 20202020202020202020202020202020 fb54ac02 51
  383.  
  384. The second byte indicates the current date and counts the months since
  385. January 1989. In the 07 card, this month code selects one of several
  386. 32-byte secret key tables that are used by the hash function. When the
  387. switch from the 07 hash algorithm to the new 09 algorithm happened on
  388. 1994-05-18, this value jumped from 40h (1994-05) to 43h (1994-08) which
  389. might indicate that the activation of the 09 algorithm was originally
  390. planned for August. In the 07 card, this value was only interpreted to
  391. find an offset into a table with various 32-byte secret keys.
  392.  
  393. The third byte seems to be a random number. This byte together with the
  394. month code is used to generate with a quite simple algorithm four XOR
  395. bytes which are necessary to decode the command byte and the card
  396. number prefix (described below). If you XOR these four bytes with bytes
  397. 8 to 11 and if you the XOR only the first of the four bytes with byte
  398. 4, then you have decrypted the card number and the command code.
  399.  
  400. The fourth byte is an encrypted command code. Some decrypted known
  401. values are:
  402.  
  403.     0x00    Deactivate whole card (message: 'PLEASE CALL 0506 484777')
  404.     0x01    Deactivate Sky Movies (message: 'THIS CHANNEL IS BLOCKED')
  405.     0x02    Deactivate Movie Channel
  406.     0x03    Deactivate Sky Movies Gold
  407.     0x06    Deactivate Sky Sports
  408.     0x08    Deactivate TV Asia
  409.     0x0c    Deactivate Multichannels
  410.     0x20    Activate whole card (remove 'PLEASE CALL 0506 484 777')
  411.     0x21    Activate Sky Movies (remove 'THIS CHANNEL IS BLOCKED')
  412.     0x22    Activate Movie Channel
  413.     ...
  414.     0x2c    Activate Multichannels
  415.     0x40    Pay-per-view account management command
  416.     0x80    \
  417.     0x81     \   perhaps 09 card ECM
  418.     0xf0     /   commands
  419.     0xf1    /
  420.  
  421. Packets with incorrect command bytes and correct signatures can
  422. irreversibly kill a card (it doesn't even answer the reset).
  423.  
  424. The fifth and sixth byte seem to be parameters for pay-per-view account
  425. management (program number and number of tokens) and don't seem to have
  426. a meaning for enabling and disabling commands.
  427.  
  428. The lower 7 bits of the seventh byte contain a channel ID.
  429.  
  430. A card number is represented by a 5 byte card address consisting of a 4
  431. byte prefix and a 1 byte suffix. The five bytes for a card are
  432. identical to the first 5 bytes of the 70h answer, only the high nibble
  433. of the first address byte seems to have a different purpose (unknown).
  434. Up to 16 cards with the same card address prefix can be addressed with
  435. one single 32-byte 74h message. The bytes 8-11 might contain the common
  436. prefix to the addressed cards and the bytes 12-27 the various suffixes.
  437. If there are less than 16 different cards to be addressed, then the
  438. same suffix byte is repeated several times in order to fill the space.
  439. The 4-byte prefix is encrypted like the command byte by XORing it with
  440. the four bytes generated using the bytes 2 and 3.
  441.  
  442. The 4 bytes 28-31 contain the digital signature which is simply an
  443. intermediate result of the iterations of the hash algorithm. If the
  444. checksum, the digital signature, or some of the values in the first 7
  445. bytes of a 74h command aren't correct, then the 78h answer will only
  446. contain 8 00 bytes or in some cases 01 00 00 00 00 00 00 00. The final
  447. byte 32 is a simple checksum that makes the sum of all 32 bytes a
  448. multiple of 256.
  449.  
  450. The 07 card (and also cards used by Sky New Zealand) have an
  451. interesting security hole: The card sends to the decoder as many data
  452. bytes as specified in P3. By sending a higher length value in the
  453. command header to the card, one can get up to 256 data bytes back which
  454. seem to be values from the card's RAM that allow some insight into the
  455. internal data structures of the card software.
  456.  
  457. 76h:
  458.  
  459. If the authorize button on the decoder is pressed for a few seconds,
  460. then the decoder will send a single 76h message with a 00 data byte to
  461. the card.
  462.  
  463. 7ah:
  464.  
  465. This command requests from the card an ASCII text which is then
  466. displayed on the TV screen. The display field is 12 characters wide,
  467. one or two lines high and no lowercase letters are supported. The lower
  468. 5 bits in the first byte indicate, how long the text is which is to be
  469. displayed: 0 for no display, 12 for a single line and 24 for 2 lines.
  470. The highest 3 bits of the first byte seem to be some kind of display
  471. priority. The number there (0-3) must be high enough if standard
  472. decoder messages have to be suppressed. The remaining 24 bytes contain
  473. the ASCII test.
  474.  
  475. The meaning of the other commands is unknown, some of them are never
  476. used currently. Perhaps these commands are used for the Fiat-Shamir
  477. identification exchange described in the patent. Some cards understand
  478. also additional instruction codes which can't be issued by a normal
  479. decoder. E.g. a BSkyB 09 card understands also 12h, 86h, 88h, 8ah and
  480. 8ch. These commands are perhaps used in order to test or configurate
  481. the card at the factory, etc.
  482.  
  483. Please contact me if you find out anything new. My e-mail address is
  484. mskuhn@cip.informatik.uni-erlangen.de.
  485.  
  486.  
  487. 5  VCL File Format
  488.  
  489. The Videocrypt Card Logfile format (VCL) is used by some peoples for
  490. performing the delayed data transfer procedure described in section 2.
  491. Person A with a valid card can record the dialog between the decoder
  492. and the card for a certain program P and transmit this information as a
  493. VCL file to person B who has no card and has recorded with a VCR only
  494. the encrypted signal of program P. Person B now connects the Videocrypt
  495. decoder between the VCR and the TV set and connects the card slot of
  496. the decoder to a PC. Using the information in the VCL file, B's
  497. computer can now also decrypt program P. This is of course only
  498. possible for the few hours which are covered by the information in the
  499. VCL file.
  500.  
  501. Not all of the information exchanged between the card and the decoder
  502. is necessary for descrambling the TV signal. The VCL format uses this
  503. fact in order to save a lot of storage space. Only 12 bytes of high
  504. entropy (that means: almost uncompressable) are stored every 2.5
  505. seconds. So a VCL file of a 1 hour program is only about 17 kbytes
  506. large. In addition, VCL files don't contain any information about the
  507. card owner (especially not the card serial number), which appears in
  508. normal full log files. (The only potential security hole is the
  509. remaining nibble in the 78h data, consequently it should be cleared in
  510. order to avoid card specific information to leak into the VCL file.)
  511.  
  512. VCL files have a very simple binary format consisting of a 128 byte
  513. header and arbitrarily many 12 byte records. At the end, VCL files may
  514. be padded with zero bytes to a multiple of the operating system's disk
  515. sector size, so that no RAM contents can leak in there out of an
  516. unsecure system like MS-DOS. Don't forget to use a binary mode if you
  517. transfer VCL files or their contents will be rendered unusable.
  518.  
  519. The 128 byte header has the following format:
  520.  
  521.       byte number       purpose
  522.  
  523.     0 -  3        ASCII String 'VCL1' which identifies the file
  524.                         type and version of the format.
  525.         4 -  7          The number of 12-byte records stored in this
  526.                         file encoded as a bigendian (most significant
  527.                         byte first) 32-bit unsigned integer value.
  528.         8 - 23          Date and time when the recording started.
  529.                         Format: yyyymmddThhmmssZ, where yyyymmdd are
  530.                         year, month and day (e.g. '19940618'), hhmmss
  531.                         are hour, minute and second (e.g. '235959'),
  532.                         T ist just the ASCII letter T, and Z is
  533.                         the ASCII letter Z if the time is UTC or
  534.                         a zero byte, if the time is local time. The 
  535.                         digits are ASCII characters.
  536.        24 - 55          Name of the satellite or cable system from
  537.                         which the recording was done. This is a zero
  538.                         terminated ASCII string with only characters 
  539.                         between 20h and 7eh. As many zero bytes are
  540.                         appended as necessary for filling up the 32
  541.                         bytes. The same format is also used for the next
  542.                         two text fields. Example: 'Astra'.
  543.        56 - 63          Name/number of the transponder from which
  544.                         the recording was done. Example: '08' for
  545.                         Sky One on Astra.
  546.        64 -127          Description of what has been recorded.
  547.                         Example: 'Star Trek: TNG, episode 123'
  548.  
  549. After the first 128 bytes follow as many 12 byte records as announced
  550. in bytes 4-7. Each record represents a 74h/78h Videocrypt protocol pair
  551. and constists of two fields: The first 4 bytes are the final 4 bytes of
  552. the 74h data part, the remaining 8 bytes are the data part of the
  553. corresponding 78h command. Four bytes of each 74h packet are enough to
  554. allow a card emulator to quickly and reliably synchronize with the
  555. queries of the decoder. The final four bytes of the 74h commands have
  556. been selected because of their high entropy (signature and checksum).
  557.